home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swags_z.zip / STRINGS.SWG / 0030_Integer to string w-comma.pas < prev    next >
Pascal/Delphi Source File  |  1993-09-26  |  789b  |  25 lines

  1. {*****************************************************************************
  2.  * Function ...... Comma
  3.  * Purpose ....... To return an integer as a string with separating commas
  4.  * Parameters .... i          Integer to return as string
  5.  * Returns ....... i as a string, with seperating commas
  6.  * Notes ......... None
  7.  * Author ........ Martin Richardson
  8.  * Date .......... May 13, 1992
  9.  *****************************************************************************}
  10. FUNCTION Comma( i: LONGINT ): STRING;
  11. { FUNCTION to place commas in a number for printing }
  12. VAR 
  13.    s: STRING;
  14.    x: INTEGER;
  15. BEGIN
  16.      STR( i:0, s );
  17.      x := LENGTH( s ) - 2;
  18.      WHILE x > 1 DO BEGIN
  19.            INSERT( ',', s, x );
  20.            DEC( x, 3 );
  21.      {W}END;
  22.      Comma := s;
  23. END;
  24.  
  25.